package com.yanyilu.basing.controller;


import com.yanyilu.basing.common.R;
import com.yanyilu.basing.service.ITotalTimeMileageService;
import com.yanyilu.basing.util.ParseJwtUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  总里程时长
 * </p>
 *
 * @author Sxx
 * @since 2020-10-26
 */
@CrossOrigin
@RestController
@RequestMapping("/mileage")
public class TotalTimeMileageController {
    @Autowired
    private ITotalTimeMileageService totalTimeMileageService;
    //获取里程时长
    @GetMapping("/frontend/getmileage")
    public R getTatalTimeMileage(){
        Integer userId = ParseJwtUtil.getUserId();
        return totalTimeMileageService.getTatalTimeMileage(userId);
    }

    /**
     *用户排名信息
     */
    @GetMapping("/frontend/rankinfo")
    public R getRankInfo(){
        Integer userId = ParseJwtUtil.getUserId();
        return totalTimeMileageService.getRankInfo(userId);
    }
}
